<?php
function save_image($inPath,$outPath){
	//Download images from remote server
    $in=    fopen($inPath, "rb");
    $out=   fopen($outPath, "wb");
    while ($chunk = fread($in,8192))
    {
        fwrite($out, $chunk, 8192);
    }
    fclose($in);
    fclose($out);
}
save_image('http://graph.facebook.com/100000881073253/picture','facebook.jpg');
save_image('http://a0.twimg.com/profile_images/457031171/favicoblogfreakz_bigger.png','twitter.jpg');

//link tham khao http://blogfreakz.com/php/how-to-save-image-from-url-using-php/
?>
